/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.reporte.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author 43579648
 */
@Entity
@Table(name = "DETALLE_DATO_REPORTE", catalog = "", schema = "APP")
@NamedQueries({
    @NamedQuery(name = "DetalleDatoReporte.findAll", query = "SELECT d FROM DetalleDatoReporte d"),
    @NamedQuery(name = "DetalleDatoReporte.findByParametroDinamico", query = "SELECT d FROM DetalleDatoReporte d WHERE d.detalleDatoReportePK.parametroDinamico = :parametroDinamico"),
    @NamedQuery(name = "DetalleDatoReporte.findByIdDatoReporte", query = "SELECT d FROM DetalleDatoReporte d WHERE d.detalleDatoReportePK.idDatoReporte = :idDatoReporte"),
    @NamedQuery(name = "DetalleDatoReporte.findByValor", query = "SELECT d FROM DetalleDatoReporte d WHERE d.valor = :valor")})
public class DetalleDatoReporte implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DetalleDatoReportePK detalleDatoReportePK;
    @Lob
    @Column(name = "OBJETO")
    private byte[] objeto;
    @Basic(optional = false)
    @Column(name = "VALOR", nullable = false, length = 400)
    private String valor;
    @JoinColumn(name = "ID_DATO_REPORTE", referencedColumnName = "ID_DATO_REPORTE", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private DatoReporte datoReporte;

    public DetalleDatoReporte() {
    }

    public DetalleDatoReporte(DetalleDatoReportePK detalleDatoReportePK) {
        this.detalleDatoReportePK = detalleDatoReportePK;
    }

    public DetalleDatoReporte(DetalleDatoReportePK detalleDatoReportePK, String valor) {
        this.detalleDatoReportePK = detalleDatoReportePK;
        this.valor = valor;
    }

    public DetalleDatoReporte(String parametroDinamico, int idDatoReporte) {
        this.detalleDatoReportePK = new DetalleDatoReportePK(parametroDinamico, idDatoReporte);
    }

    public DetalleDatoReportePK getDetalleDatoReportePK() {
        return detalleDatoReportePK;
    }

    public void setDetalleDatoReportePK(DetalleDatoReportePK detalleDatoReportePK) {
        this.detalleDatoReportePK = detalleDatoReportePK;
    }

    public byte[] getObjeto() {
        return objeto;
    }

    public void setObjeto(byte[] objeto) {
        this.objeto = objeto;
    }

    public String getValor() {
        return valor;
    }

    public void setValor(String valor) {
        this.valor = valor;
    }

    public DatoReporte getDatoReporte() {
        return datoReporte;
    }

    public void setDatoReporte(DatoReporte datoReporte) {
        this.datoReporte = datoReporte;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (detalleDatoReportePK != null ? detalleDatoReportePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleDatoReporte)) {
            return false;
        }
        DetalleDatoReporte other = (DetalleDatoReporte) object;
        if ((this.detalleDatoReportePK == null && other.detalleDatoReportePK != null) || (this.detalleDatoReportePK != null && !this.detalleDatoReportePK.equals(other.detalleDatoReportePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.reporte.modelo.DetalleDatoReporte[detalleDatoReportePK=" + detalleDatoReportePK + "]";
    }

}
